package com.ybw.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mybatis-plus 配置
 *
 * @author ybw
 * @version V1.0
 * @className MybatisPlusConfig
 * @date 2024/12/2
 **/
@Configuration
@MapperScan("com.ybw.mapper")
@Slf4j
public class MybatisPlusConfig {

    /**
     * 最新版
     *
     * @methodName: mybatisPlusInterceptor
     * @return: com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
     * @author: ybw
     * @date: 2024/12/2
     **/
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
